package com.example.demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.Goods;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 整合mybaits-plus
 */
@Repository
public interface GoodsDao extends BaseMapper<Goods> {


    @Select("SELECT * FROM pdt_goods")
    List<Goods> getAll();

    @Select("select stock from pdt_goods where id = #{goodsId}")
    Integer getStockByGoodsId(@Param("goodsId") String goodsId);
}
